DRC Angumu
library(afrihealthsites)
## Loading required package: sf
## Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
library(afriadmin)
##
## Attaching package: 'afriadmin'
## The following objects are masked from 'package:afrihealthsites':
##
## country2iso, iso2country
library(sf)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(osmdata)
## Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library(acled.api)
##
## By using this package, you acknowledge that you have read ACLED's terms and
## conditions. The data must be cited as per ACLED attribution requirements. To
## download ACLED data, you require an ACLED access key. You can request your key
## by freely registering with ACLED on https://developer.acleddata.com/.
## The package may be cited as:
## Dworschak, Christoph. 2020. "Acled.api: Automated Retrieval of ACLED Conflict
## Event Data." R package. CRAN version 1.1.5.
## For the development version of this package, visit <https://gitlab.com/chris-dworschak/acled.api/>
## WHO database
# with interactive map
hsdrc <- afrihealthsites("democratic republic of congo", datasource='who', plot='mapview')
admdrc <- afriadmin("democratic republic of congo", level=2, datasource='geoboundaries')
## Registered S3 method overwritten by 'hoardr':
## method from
## print.cache_info httr
ituri <- filter(admdrc,shapeName=="Ituri")
hsituri <- st_crop(hsdrc,ituri)
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
plot_drc <-
ggplot() +
geom_sf(data = ituri, color = "green", size = 0.5, alpha = 0.6) +
geom_sf(data = hsituri, fill = "black", color = "black", alpha = 0.4)
plotly::ggplotly(plot_drc)
# Angumu
angumu = getbb("Angumu", featuretype = "boundary",
format_out = "sf_polygon")
plot(angumu)

angumu_opq <- angumu %>% opq()
## bb_poly has more than one polygon; the first will be selected.
# features
angumu_street <-
angumu_opq %>%
add_osm_feature(key = "highway") %>%
osmdata_sf()
angumu_water <-
angumu_opq %>%
add_osm_feature(key = "waterway") %>%
osmdata_sf()
xxx <- filter(angumu_street$osm_lines)
crop <- st_intersection(angumu, xxx)
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
hs_angumu <- st_intersection(angumu, hsdrc)
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
river <- filter(angumu_water$osm_lines) %>%
filter(waterway == "river")
stream <- filter(angumu_water$osm_lines) %>%
filter(waterway == "stream")
river_crop <- st_intersection(angumu, river)
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
stream_crop <- st_intersection(angumu, stream)
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries
plot_angumu <-
ggplot() +
geom_sf(data = angumu, color = "red", size = 2) +
geom_sf(data = crop) +
geom_sf(data = stream_crop, color = "#2792a5") +
geom_sf(data = river_crop, color = "blue", size = 1) +
geom_sf(data = hs_angumu, color = "yellow", size = 3)
plot(plot_angumu)

# Add aceld.api
# https://www.rdocumentation.org/packages/acled.api/versions/1.1.5